import os

image_dir = r'D:\YOLOv11\datasets\ct\fu'
label_dir = r'D:\YOLOv11\datasets\ct\labels'

os.makedirs(label_dir, exist_ok=True)

image_files = [f for f in os.listdir(image_dir) if f.endswith('.jpg')]

for img_file in image_files:
    label_file = os.path.splitext(img_file)[0] + '.txt'
    label_path = os.path.join(label_dir, label_file)
    
    if not os.path.exists(label_path):
        # 创建一个空文件作为负样本标注
        with open(label_path, 'w') as f:
            pass

print("已完成空标注文件的生成")
